﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CharacterCreation.Data.Models {
    public class Essence : Statistic {
        public Essence() {
            this.Name = "Essence";
        }

        public override int CalculateStatistic(int start, int racebonus, int xp) {
            int temp = start;
            while (xp > 0) {
                if (temp < 25 && xp > 2) {
                    temp++; xp = xp - 3;
                }
                else if (temp < 31 && xp > 3) {
                    temp++; xp = xp - 4;
                }
                else if (temp < 37 && xp > 4) {
                    temp++; xp = xp - 5;
                }
                else if (temp < 43 && xp > 5) {
                    temp++; xp = xp - 5;
                }
                else
                    xp = 0;
            }
            return temp + racebonus; 
        }
    }
}
